package com.xmall.exception;

import com.xmall.define.base.ResultCode;

/**
 * 自定义异常
 */
public class XmallException extends RuntimeException{

    /**
     * 异常码
     */
    private Integer code;

    /**
     * 异常数据
     */
    private Object data;

    public XmallException(ResultCode resultCode) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public XmallException(ResultCode resultCode, Object data) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
        this.data = data;
    }

    public XmallException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
